const redis = require("../utils/redis");

redis.init({
    HOST : "39.96.91.32",
    port : "6118",
    password : "tCt4x5sClKfyJV!a"
})

async function test(){
    let roomId = 279311
    let roomInfo = await redis.getRoomById(roomId)
    let gameInfo = await redis.getGameByRoomId(roomId)
    console.log("roomInfo")
    console.log(roomInfo);
    console.log("gameInfo")
    console.log(gameInfo)
    // return;
    for(let roomSeat of roomInfo.seats){
        let {userId} = roomSeat;
        let location = await redis.getUserLocationById(userId)
        if(location && location.roomId == roomId){
            console.log("------------userId:"+userId)
            await redis.removeUserLocation(userId)
        }
    }
    await redis.removeRoom(roomId)
    await redis.removeGameByRoomId(roomId)
}
test();
